To flank is to be directly on the other side of a character who is currently attacking another character. A flanking attacker gains a +2 flanking bonus on attack rolls against the defender. (This does not count towards the +20 attack bonus cap.) A rogue can sneak attack a defender that he is flanking. For example, suppose characters A and B are attacking one another. Should character C decide to attack either of them, he/she would receive a +2 AB flanking bonus.
The dwarven defender feat defensive awareness II prevents a character from becoming flanked. In addition, a character performing a whirlwind attack cannot be flanked.