Messages sent to other iOS devices (like iPhones) using iMessage appear in blue, messages sent to non-iOS devices (or iOS devices not supporting iMessage) appear in green. In other words, the blue messages go through Apple's iMessage system and the green ones go through your carrier's messaging system.
Blue = iMessage
Green = non-iMessage
Currently, iMessage is only availble for iOS 5. So where you send text / photos / videos to someone who also has iOS 5 installed, the messages appear blue. Otherwise they are green.
This is very useful for knowing beforehand whether you'll be charged SMS/MMS fees, especially if you're messaging with someone in another country.
Learn more about iMessage here:
Green is SMS. SMS counts against the texting plan with your carrier (if you have a plan).
Blue is iMessage, a service from Apple that does NOT count against your plan.
For sending iMessage, the recipient must have the following:
iPhone, iPod touch, or iPad
iMessage ON in Settings.