With patch 2.0.1, Blizzard introduced a secondary targeting system called a focus.
With focus, you can have an additional target (freindly or enemy), which can then be referenced in a macro. While this by itself is a great feature, the use of an addon that will create a focus frame similar to your normal targeting window makes it even more beneficial.
I currently use the FocusFrame addon, but I know that x-pearl also has the capability to create the frame.
Below are some examples on how I use this command
Warrior Dual Tank Target Swap
If you right click this macro, it will set the current target as the focus, and then stop the macro.
If there is no target or focus, it will also stop the macro.
If you do have a target and focus, left clicking this macro will swap them.
/stopmacro [target=focus,noexists] [noexists]
I use this a lot to help keep aggro on two targets. While fighting the main, I will click the macro, Devastate once or twice on the second target, and then click it again to switch back to the main target.
Hunter Pet Attack Focus
I have the button for this macro keybound to my middle mouse button. It allows me to set the focus to whatever my mouse is hovering over, and then have my pet attack that target. Because it doesn't affect any of my targeting, I can contine to keep shooting whatever I am attacking.
I also have a line to set my target to whatever my mouse is over if I don't already have a target.
/target [noexists] focus
Priest Shackle Focus
This is a macro I just wrote to help priests shackle a target.
If you left click the macro, it will clear the focus, set your current target to the focus, and cast shackle.
Once you have a target shackled, you can right click the macro to swap back to the focus, shackle the target, and then switch back to your previous target.
/focus [target=focus, noexists] target
This macro could also be modified for a mage to sheep the focus