Cut from the Air
When a ranged attack is made against you or a target adjacent to you, you can cut the weapon (or ammunition) out of the air, deflecting the attack so the target takes no damage. As an attack of opportunity, make a melee attack roll at your highest bonus. If the result is greater than the attack roll total of the ranged attack, the attack is deflected. You must be aware of the attack and not flat-footed. Unusually massive ranged weapons (such as boulders or ballista bolts) and ranged attacks generated by spell effects cannot be deflected.
Could you use it in these cenarios if you have a reach weapon?
A enemy 30ft away that you see makes a ranged attack against you.
A enemy 30ft away that you see makes a ranged attack against a ally adjacent to you.
A enemy 5ft away that you see makes a ranged attack against you.
A enemy 5ft away that you see makes a ranged attack against a ally adjacent to you.
A enemy 30ft away that you see makes a ranged attack against a ally 10ft away from you.
A enemy 5ft away that you see makes a ranged attack against a ally 10ft away from you.
And another question just to clarify "attack at your highest bonus" means the highest BAB plus and minus everything else that you have at the moment like weapon enchantment bonus or power attack right?