You see.... Mech is the Achilles heel of the Tyranid army. If nids are making life difficult for you, buy transports. That will solve most of your problems. Tyranid players really only have a limited selection of anti-vehicle options available to them.
Hive Tyrant- His main use is supposed to be as general of the swarm not an anti-mech gunbeast. But if you do use him to crack a few armored nuts you have 3 options;
- With Wings and 2 sets of Scything Talons. The wings give him the mobility to catch vehicles and the 2 sets of scything talons allow him to re-roll misses in case the tank moved. The added dice on the armor penetration roll is nice and his high toughness keeps him relatively safe if it blows up. On the downside he's 230 points.
- Venomtyrant with a Heavy Venom Cannon. Long range and very high strength usually means a good anti-armor gun but this one comes up short due to it's -1 to the damage roll. It's not good enough to only shake a vehicle anymore. Plus it's 195 points base with a ballistic skill of 3.
- Dakkatyrant with 2 sets of Twin-Linked Devourers with Brainleech worms. Rolling 12 strength 6 shots that re-roll misses is awesome in any codex. It should shred light armor with ease. Too bad it's AP- so it gets a -1 on the vehicle damage chart, has an 18 inch range and costs 230 points to field.
Zoanthrope Brood- Another awesome unit choice that is very effective at taking out any armor in the game. The Warp lance is incredibly potent. He has a few weaknesses such as his toughness 4 being magnetic to every missile launcher on the battlefield, too easy to counter with a Psychic Hood, and was wrongly placed in the Elite section instead of the Heavy Support section.
Genestealers- Both Ymgarl and normal Genestealers are highly effective as vehicle killers. Rolling a bucket full of rending attacks is a near guaranteed way of blowing up anything with AV13 or less. That's where the problem is; it won't work on AV14 and works way too well on AV10-13. I've had battles where I lost more Genestealers to exploding vehicles than I have to enemy shooting.
Termagants- Don't laugh, they can do it. If they can maneuver around a vehicle their Strength 4 Fleshborers can score a ton of glances and follow it up with an assault. If they're equipped with Adrenal Gland they will assault at strength 4 against the rear armor. Even though they're "only" glancing they usually do enough glances to take a vehicle apart piece by piece. As a bonus they can't cause a vehicle to explode as rending Genestealers can.
Warriors, Shrikes and Raveners- These 3 can be dangerous to light vehicles either through shooting or close combat with rending claws. Too bad it's a crap ton of points to be marginally effective at anti-light mech duties. They're much better at killing what's inside the vehicle instead of the vehicle itself.
Harpy- At 170 points it's the cheapest Heavy Venom Cannon in the codex. Too bad it's toughens 5 with a 4+ save on an easy to target monstrous creature who has a difficult time getting a cover save.
Carnifex- While he's a bit over priced the original bad boy of the codex has a few builds that can do the job.
- Basic with no upgrades will set you back 160 points but he will charge in with 5 attacks that re-roll misses and 2d6+9 to penetrate armor. If he can catch the vehicle he'll probably wreck it. Catching it is the hard part. Those things won't stay still while he plods his way across the battlefield.
- His shooting options are the same as the Hive Tyrant; Venomfex or the Dakkafex. With these guns his performance is equal to the Hive Tyrant but at a cheaper cost, 185 and 190 points.
Trygon- With Fleet he moves fast, as a monstrous creature he rolls an extra dice to penetrate, rolls a ton of dice on the attack roll that can re-roll misses, and has enough wounds to survive your opponents attempts to stop him. Plus he's the attention magnet the rest of your army needs to survive. The moment he gets close your opponent will stop at nothing to stop him from doing anything. This should be your vehicle killer of choice were it not for the fact that he's still more expensive than 3 Zoanthropes or 3 Hive Guard who can do just as much and from farther away.
I suppose the real weakness of the Tyranid codex is that it's completely boned by the current Mech centered metagame. The best anti-mech broods in the codex are all in the same FOC section and compete with other just as awesome Elite choices like the Doom of Malan'tai, Deathleaper and Ymgarl Genestealers.