PHOTO COURTESY OF FIXMYFURNACE.COM
An expansion tank, like the one pictured above, is a cylindrical tank with a rubber bladder inside filled to a certain pressure with air. This acts as a buffer of sorts for the expansion and contraction of water pressure. They take all of the pressure off of the water heater and water delivery lines. They are code in most areas nowadays and may be needed for some warranty claims.
You can test to see if yours has failed in a couple ways. The first is to give it a tap on the top and then a tap on the bottom. If you notice no difference in the sound, then it may be bad. The next, sure fire way to check is to pull the cap off the bottom of the tank and press in the valve core (little metal button in the center of the threaded nipple, shown in photo below). If water sprays out, it needs replaced. Generally, expansion tanks last around 5-7 years.
PHOTO COURTESY OF FIXMYFURNACE.COM