Flashing your phone can mean one of many things, but they all revolve around erasing your phone's memory or operating system and replacing it with another.
Upgrading Your Software
Upgrading your software to the latest version is the most common form of flashing a phone. Most manufacturers have an automated process that can be done through the menu system on the phone. On an older model that doesn't offer an over-the-air update, you may have to visit a service location to complete the upgrade.
Erasing the Memory
Phone flashing can also mean erasing the phone's memory and taking it back to the manufacturer's default setting. Some phones offer this feature in the security section of the device, for others you may need to know a key code and the device master subsidy lock, which is a six-digit number that your carrier has.
Changing Your Carrier
Flashing can also mean replacing the operating system on your phone so that it can work on a different carrier, like flashing a Verizon Razr to work on Sprint's network. This is very complicated, only works if two carriers use the same model of phone, and even experts who attempt this often wind up rendering their phone useless. Even if they are successful they end up losing some of the features of their phone and, of course, void their warranty.
Erasing Your Operating System
If a software glitch has eroded your phone's performance, or an upgrade has had negative consequences on your phone, you can flash it to remove the operating system, making it a blank slate. From there you can load the software package that you want.
Flashing of any kind involves deleting information. This includes all of your information like your phone book and calendar. The automated upgrades back all this up for you and restore it without you having to do anything, but all other flashing methods will erase your information. Make sure that you have your device backed up, or if it's not a model that can be backed up on a PC, write down all information that you can't live without.