This is the focus macro I currently use:
/focus
/targetlasttarget
To use this, you must have the target you want as your focus targeted when you hit the button. After using it, you will then target whatever you were targeting before the focus target. For example:
- Targeting Boss A.
- Enemy B shows up, I want it as my focus.
- Target Enemy B.
- Hit focus macro.
- I am now targeting Boss A, and have Enemy B as my focus.
The name of a specific enemy or target can be placed after "/focus" as in:
/focus EnemyB
If you know the name of what you want focused for a certain fight, you can have this ready and get rid of Step 3 in the previous list.
As dlanod said, a focus gives you another health bar on your screen to monitor. When using a focus, you can be fighting one thing while still paying attention to something else in a fight. There are quite a few situations where this is useful.
In PvE:
- Multiple targets; waiting for conditions before killing. Allows for quick target changes and monitoring. For example, on the Spine of Deathwing fight, the Hideous Amalgamation cannot be killed until it reaches 9 buffs from the dead Corrupted Bloods. Setting the Amalgamation as your focus can allow you to watch its buffs until it reaches 9, then quickly switch over and finish it off (without having to find its specific nameplate). This is only one example, there are other outdated fights that this was extremely handy on.
- Multiple targets; must watch activity of one. Allows a player to know what's happening on the target that isn't currently targeted. For example, on the Rotface fight in Icecrown Citadel (old), the boss would spawn an add that would chase a player around and eventually blow up after casting a spell. When the add spawned, you could use this macro to focus it seamlessly and watch its cast bar so that when it started to cast the spell to blow up, you could run where you needed to go. All without turning away from or losing dps on the boss.
In PvP:
- Watching a healer. Say you're in an arena, or even a battleground. You're going up against two or more people, at least one of which is a healer. For whatever reason, you're not going after the healer. Set the healer as your focus. You can now have his cast bar and mana bar for quick reference, as well as his nameplate if you want to make a quick switch, interrupt, stun, or cc. As the focus macro you have shows, there are macros that let you do this simply by pressing shift+ability to have it applied to your focus.
- Watching a caster. Same reasoning as the healer, except mostly just for cc purposes, or to interrupt/spell reflect/simulacrum/cloak that huge deadly spell he's about to unleash on you.
- Watching anyone else. That annoying warrior that's going around decimating everything, the death knight that's controlling the entire midfield, the pally that two shots anything if he has wings up, etc. Having them as a focus will let you see if they're targeting you or not, and what buffs they have and let you take action if they're eyeing you as their next victim.
There are of course other ways to employ your focus, but this is the general outline. Not everyone and not every class benefits from using a focus as much as others.