A rank is a promotion from a town governor. There are several ranks, including Admiral, Baron, Colonel, etc. As you attack more ships and cities you will get promoted. Duke is the highest rank. The governor of any city can promote you, and Governor's daughters have a minimum rank required to take them to the ball. Even if you are against a nation's interests, your achieved rank will not go down. For example, you achieve the rank of Duke with Spain but you want to get the same rank with the English as well. You start attacking ships, and you have a bounty placed on your head by the Spanish. When you retire, however, the stated rank will still be the highest you ever achieved with that nation, not your rank with them at retirement.
Ranks and the bonuses they grant:
Captain: Crew recruitment will be easier in ports of the same nationality. (That is, you'll get more guys from the taverns than you normally would.)
Major: Repairs in shipwrights of the same nationality become cheaper.
Colonel: Merchants of the same nation will have more goods to sell you.
Admiral: Ship upgrades become cheaper in shipwrights from the same nation.
Baron: Crew recruitment gets even easier from taverns of the same nation, and you gain another 50 acres of land.
Count: Ship repairs are free in your own nation, and you get 50 more acres. Yeah, baby!
Marquis: Merchants from your nation will sell even more goods, and you'll get 100 more acres of land.
Duke: Ship upgrades are free in your nation.