If a character has Tunnel Fighting and Polearm mastery, could a character get up to 3 opportunity attacks, on a single creature, in the same turn, just from that creatures movement? Once for entering their reach, again for moving within their reach and a third for leaving their reach.
The attack you get from Polearm mastery when the creature enters your range, as well as the one you get when it leaves your range are refered to as opportunity attacks, which use your reaction. The Tunnel Fighter fighting style from the Unearthed Arcana: Light, Dark, Underdark! says:
While in your defensive stance, you can make opportunity attacks without using your reaction, ...
No problem here, rules are clear. So you get those guaranteed when the creature enters and leaves your range. In addition:
and you can use your reaction to make a melee attack against a creature that moves more than 5 feet while within your reach.
So the third attack of opportunity is possible as well. However, the wording more than 5 feet while within your reach leaves room for some interpretation. On the 5ft² grid I would rule such, that you don't get the attack when the creature enters your reach and leaves immediately. As soon as it moves from a point within your range to another point within your range, it has made 7.5 ft of movement and thus qualifies for the attack.