Employee attempting to shift gears going up grade with truck. Got it out of gear. The truck rolled backwards into a ditch and turned on its side. Employee got out, noticed a fire starting in engine compartment. Used fire exinguisher but did not get fire undercontrol.