Quote from Black_Drath
It does not attack undead mobs. Skeletons, wither skeletons, zombies, zombie pigmen and other withers will not be targeted.
The reason the Wither attacks these mobs is because it seems to get a small health boost whenever it kills something.
That's what the OP said, it attacks anything alive.