Pirates and Privateers are different groups, but they both can attack any ship of an enemy nation and keep the spoils of their conquests.
Privateers are civilian Captains that get a Letter of Marque from their government, this allows them to attack any enemies of the nation. Sometimes they are seen as extensions of a nation’s Navy, but Navies are not in the habit of attacking civilian ships. Privateers can also accept contracts to capture or sink a specific ship for bounty. Privateers are often used to disrupt enemy trade and hunt wanted enemies.
Pirates are not of a nation. A Captain can join one of the seven Pirate Brotherhoods, organizations that dedicate themselves to the raiding and looting of ships and ports. Pirates are outlaws, they are refused entry to any port, except for those of Rogue Nations such as the Barbary States and the Sulu Sultanate. They can hold their own ports or camp in remote places. A Brotherhood exists to support their brothers and sisters by selling their loot and providing them with ships, crew, soldiers, supplies and a safe haven. A Brotherhood elects their leaders by votes from all members. As Pirates are the enemies of all nations except the Rogue Nations, they can attack nearly all the ships at sea.