Do weapon sub-types have any meaning mechanics-wise?
Wiki entry on weapons says just that:
Weapons can be categorized into three main groups: Melee Weapons, Ranged Weapons and Caster Weapons
and only lists sub-categories of the above ones.
Do these weapon types and sub-types serve any other purpose than the cosmetic one?
Individual weapon types matter for some devotions
Specific types (e.g., "sword," "axe," etc.) matter for devotions sometimes. For instance, the stars in the Berserker constellation only apply if you're wielding an axe.
Note that, if you're dual-wielding, only one of your weapons needs to be the required type. Dual-wielding an axe and a sword will let you benefit from Berserker and Blades of Nadaan simultaneously, and the bonuses will not be local to the matching weapon.
Melee vs. ranged matters for obvious reasons
Melee weapons hit bad guys up close. Ranged weapons shoot bad guys far away. Many skills, including all default attack replacers, but also other skills like Primal Strike, inherit their melee vs. ranged behavior from your equipped weapon. Some skills, like Forcewave, can't be used unless you're wielding a melee weapon (or a shield).
Any skill that says something about being a "ranged technique" or "ranged weapon bonus," like Inquisitor's top row of passive skills, will also only work if you have a ranged weapon equipped, and ditto for "melee technique" and melee weapons (e.g., Nightblade's top row of passives).
The "caster weapons" category matters for weapon affixes
The only "caster weapon" types in the game are daggers and scepters. The only impact this has is that caster weapons have different random affixes they can roll. For instance, the Superior prefix, which adds flat physical damage to a weapon, cannot roll on scepters or daggers.