Sure, why not? It wouldn't be difficult to do. They just come up with a scientific evaluation of the average amount of flatulence created by eating a specific quantity of beans, broccoli, etc. and levy the tax on those products.
It's just a darned shame that it will hit vegetarians and vegans more than meat eaters but, as VP Biden said, "it's time to be part of the deal."
Remember , Methane is 21 times more potent than CO2 as a greenhouse gas. So... lay off them beans, dude!