Have a look at the LyX Customization manual (Help > Customization), section 5.2.1, and then take a peek at some of the .module files in the LyX layout folder to see some examples. Basically, you define the environments in a module (or modules), including the LaTeX command you will use to invoke the environment, any LaTeX code needed to define that command (to be inserted into the preamble), and details of how LyX should display the environment.
/Paul