The Melee Resistance Perk is unlocked upon reaching level 41 and reduces the amount of melee damage your king, units and buildings take.
You, your units and all of your buildings start the game with +30% resistance against melee attacks.
This stacks multiplicatively with the Blacksmith Melee Resistance upgrades.