What is a grounding wire?
It's important to be sure that your house's electrical system is grounded, which means that it is somehow connected to the ground. This ensures that excess charge that might build up in any possible way is sent back into the ground where it can safely dissipate. This is what that bottom hole in an outlet is for — though current normally flows through only the top two rectangular prongs, in the event of a short circuit it uses the ground prong on the bottom.
The grounding wire also helps protect your house from lightning. If lightning were to strike your house and a power surge happened, the ground wire provides a preferable path for all that charge. Instead of flowing through your house's circuitry, the excess charge would go directly into the earth.
Grounding wires also prevent shocks:
Grounding to the water pipe
Many older homes are grounded to the water pipe, which is not done anymore because it is unsafe. Older pipes used to be made of copper, which was safe then. But now, most repairs to pipelines are usually made with PVC fittings. PVC, an insulator, would break the flow of charge along the water pipe. If these fittings occur relatively high up in the water pipe, charge may not travel sufficiently deep into the ground for the pipe to serve as an effective grounding mechanism.