They might, if for no other reason because it's not such a terribly bad idea, and it works with the plot. It's a better plan than shouting and kicking in the front door, anyway.
D&D 5e is less specific, but up to at least 3.5 the descriptions of fire-based spells such as Burning Hands explicitly said in their decription:
Flammable materials, such as [...] thin wood burn if the flames touch them.
So, one may conclude that D&D generally considers wood to be flammable, within limits (note the word "thin"). Arguably, the staves of a barrel are thin-ish, so that would do.
In reality, barrels are often made out of oak, and oak is pretty poor at quickly catching fire. Oh sure, it does burn, finally, it's just that holding your lighter up to it for a few seconds won't do much but scorch the surface a bit.
Plus, combustion is bound to temperature, and a beer-filled barrel has a huge volume of thermal absorbant (beer) inside. That will make it even tougher to really "burn" other than getting scorched very superficially.
The beer itself will not burn, even if it's a Bulldozer-alike. You can quickly ignite (for half a second or so) watery liquids containing 35-38% of alcohol, but to truly burn, it needs to be above 50%. Something 5-10% alcohol? No way.
But then, it's a game, games are about having a fun experience, and trolls don't know that barrels don't burn well. Nor do we know what kind of dwarf piss an average troll considers "beer". Might well contain 50% alcohol.
So if you can successfully trick those trolls by burning some barrels, why not. Maybe the players should add a few handfuls of straw or cloth and spill a little oil to account for, uh, the overall physical correctness and to please the nitpickers in the group. But in general, I see no objection.