Here is what is in the rules:
Units with this keyword are able to use specialized weapons in order to avoid enemy attacks. After a melee attack against this unit is rolled, the controller of this unit may discard X order tokens (that match the attacking unit's rank) to ignore X hits.
*also if they have a polearm, they discard an additional hit.
Here is an example:
A blue unit for Lannister attacks a unit of Manderly Trident Bearers. They roll three dice and get to hits. The person controlling the Maderly unit can discard one blue order token (from his order pool) to ignore one of the hits. This unit can also ignore the second hit because it has polearm.
Basically X is just the number of order tokens used by the person controlling the unit. If you put in 3 tokens, you can avoid 3 hits (plus any additional due to other rules).
Hope this helps.
Also, just so we're on the same page about attacks and hits. If a blue unit attacks a blue unit, it rolls 3 dice. If the result is 2 Greens and a Blue, the unit that was attacked takes one hit. Basically, you have to roll the color of the unit you are attacking to hit it.