Pirates didn't have running water on their wooden ships (and in case you didn't know it, you can't survive on sea water because of the salt). So all the water to be consumed on a voyage had to be brought along in barrels. Over the course of a few weeks, the water would get algae in it.
To keep the water from growing, they would sometimes put salt in it (enough to kill algae but not pirates). Or they would put some alcohol in it. Pirates of the Caribbean found an abundant supply of "kill devil," an alcohol that came as a byproduct of sugar cane production. When people began to cultivate kill devil on purpose, its name became rum. A bit of rum in water (and sometimes also with a little salt) is the drink that became known as "grog."
Rum was very cheap and abundant in the Caribbean, and so it was the alcohol of choice for our brethren around the Spanish Main. The Royal Navy gave strict rations of hootch, but pirates could be freer, at least when recruiting Navy sailors. During a voyage, the captain would still ration the rum, and the Articles usually outlined stiff penalties for being drunk during battle.