When cooked properly, the onions should never burn. The goal is to first sweat them over a medium heat, then to slowly cook them over a lower heat. This allows the natural sugars to be released, which in turn allow the onions to caramelize. If the heat is too high or the onions aren't stirred enough, the sugars will burn. Patience is key here.