This happens because the Rich-text Editor will attempt to "clean" all content you entered into it upon saving the content. It does this in an attempt to be sure that the formatting is correct, produce text that does not contain any missing closing tags, remove incorrectly nested tags, etc. This feature has an ill effect on some code snippets.
If this happens with the code snippet you are trying to add to your content regions, you need to use either a Designer Region or embed your code snippet directly into a Custom Page Style.
There is a great benefit from this approach as well, as it protects your code from accidental alteration by others, since edit access to Designer Regions and Pages Styles is available only to Users with the Designer Role.