The tool-tip description of each type of Character gives a suggestion of what type of troops they are "best grouped with" in their retinue.
Excels at inspiring friendly troops, but weaker in melee. Best grouped with retinues of Melee Cavalry.
The colours of the heroes seem to match up with the recommended troop types from what I can see (Commanders are yellow, Melee Cavalry are yellow, Strategists are blue, Ranged Infantry are blue).
Is there was a specific mechanical benefit that these heroes receive by having the suggested troops in their retinue, or is it just general tactical advice?
There are two reasons
1) Some characters get special abilities, which only affect troops of that colour. e.g. strategists (blue) get an ability, which allows archers (also blue) to shoot fire arrows. Some commanders get the ability to let their cavalry use the wedge formation.
2) Advanced troop types can only be recruited by a general of the corresponding colour. So, an elite unit of yellow cavalry can only be recruited by a yellow general.