Very simply Files are a collection of bytes that can be interpreted anyway you choose (but will only be interpreted correctly following the proper steps for each individual file). The extension is used as a tip for how you should go about interpreting this file. When a developer makes a file-type you've never heard of it's because it's his/her own custom file-type that suits his/her own purposes, or he/she just doesn't want you to know what file-type it is at all by making a random oneextension.
You can do something like this by reading the byte data of files, and writing it back into a larger one. Nothing is stopping you from writing the file data of several files into one larger one as long as you know how to read the individual file data back to suit your own needs.
This is how compression works. It takes the original file data and runs algorithms to create new condensed file data that can be reworked using similar techniques into the original file. For example a .zip extension just tells you that the file data is compressed data using the zip format, and will be pretty useless to you interpreted in any other way.
Read up on basic file input/output in your language of choice for the actual HOWTO of working with file data.