*First, the macro sets your maximum target distance to 10 yards (melee range for special attacks).
*Then, if your current target is dead, it targets a new enemy (just like your normal "T" or tab button would) within 10 yards.
*If your target is not dead, but cannot be harmed (is another player, or a friendly NPC, etc), it will target a new enemy in 10 yards.
*Then, so you don't get screwy results in general tanking, it resets your max target distance back to normal (41 yards).
It's basically a failsafe for when you kill a target, so you don't waste a cooldown before you are on another target. I wrote it specifically for my Shield Slam/Trinket macros so I would max out overall damage from the trinket use (if you macro and time every one perfectly, you get 4 Shield Slams instead of 3). However, it's also a handy failsafe for other attacks and abilities, so I put it in there.