Thermochemical treatment of biomass in a flow of steam or in a mixture of steam and carbon dioxide