There is actually a clear and easily explained formulation difference between these two beverages. In the industry this is known as "diamonds" and "spheres".
Diamonds refers to the sugar content, spheres to the carbonation (that's the little bubbles for the vocabulary challenged). Coke is high spheres low diamonds, Pepsi is high diamonds low spheres. Relatively speaking of course! The actual differences are quite small.
This is primarily why Pepsi wins the Pepsi Challenge: if asked to choose which they prefer after trying two nearly identical flavours one after the other, people will almost always prefer the slightly sweeter one. You can verify this with other acidic drinks. Squeeze two glasses of fresh orange juice, add a quarter teaspoon of sugar (no more or it will be too sweet!) to one of them, mix well, "Pepsi Challenge," and people will pick the sugared beverage almost four times out of five.
Some folk will swear they can tell that Pepsi uses vanillin, and Coke real vanilla. Although they are correct on the formulation -- the other Pepsi/Coke difference -- it is extremely unlikely that this is the difference they are detecting, something that you can verify with another type of "Pepsi Challenge". This is actually a kind of double blind test; but don't tell them that! Here's how you set it up: tell your vanillin/vanilla friends you bet they can't tell the difference. Then, present them with two glasses of black carbonated liquid, but make them both the same! People will swear that this one is Pepsi and that one Coke. The reveal is priceless!
I use my knowledge of the spheres'n'diamonds to better enjoy my Colas, drinking Pepsi in the daytime and Coke at night, as I know that's how I generally prefer other foods: savoury at night and sweet when the sun shines! Your mileage may vary.