Brightpearl's templating system in 'visual mode' will add extra formatting around the HTML, thus if you switch to that view at any point and switch back to the HTML view and hit save, you'll have picked up extra formatting causing the template to become incorrect. This also means that to edit the template at any point after you've saved it, you'll need to re-paste in the HTML code, as by default Brightpearl's template editor page starts in visual mode.