A contested territory is any area in which players playing on a PvP server will find their PvP flags turned on. Any player can be attacked by a player of an opposing faction while in these zones. Some contested territories are Alliance favored (generally they will have more Alliance outposts, cities, or are just closer to a main Alliance city or territory), some are Horde favored, and some do not favor one faction.
Neutral cities may be located within these zones where Alliance and Horde coexist such as Gadgetzan and Booty Bay. Trying to do PvP while near a guard in a neutral city will result in the guard becoming hostile to whoever started the fight. Both Alliance and Horde must behave while within earshot of a guard, as they'll do a little more than ask you to take it outside. Even indirect participation in a fight (i.e. healing one of the combatants) will flag the healer for PvP and bring the guards down on the player.
Battlegrounds are also contested territories, regardless of the realm type you are playing on.