Visa and Mastercard have divided the world up into regions. The regions are similar between the two but not always identical. Visa is generally more permissive than Mastercard. Territories like Andorra, Monaco, and Switzerland are ones where they differ and Visa might lump them in with EU/EEA in some contexts, whereas Mastercard doesn't always.
Gibraltar (along with Isle of Man, Jersey, and Guernsey) falls under UK. Non-European territories of UK are not included in the UK region.