In addition to setting up your tanks in better positions, you can also try,
Spider Mines are essentially free. Place them on the path of the enemy tanks. Plus the computer won't scan when it walks to your base.
Placing mines are a bit tricky. You'll notice that if you select 12 vultures and tell them to all place a mine in a single spot, only 1 mine will be placed by 1 vulture. You need to manually split the vultures and spread the mines.
For an example of killer spider mine placement, check out Boxer's Minetrap from 2005 Season 1 Starleague Finals
Higher resolution video of Boxer placing mines
A dozen cloaked wraiths will quickly snipe tanks.
This takes a bit more micro because first you'll have to kill off the marines or goliaths that a computer usually sends along, and then pick off the retreating tanks.
Or you can dodge in and try to pick off the tanks. The computer will scan. Dodge out just as the scan is going down to minimize the daage that is taken. Wait for the vision from the scan to wear off. Dive back in. Repeat.