The PDF specification comes with a feature called Optional Content that will allow you to group content. A groups visibility can be controlled in various ways. The Core component offers classes to handle them at a very low level. A common way to turn a visibility on and off is the Layer pannel in a Reader application.
The Merger component will import optional content groups by default, too. It can be controlled by the last parameter of the addFile() and addDocument() methods.
The example will merge two document that make use of layers while leaving the layer information of the second document. The original documents can be seen here and here.