This is from my MazeChase game and it features dynamic tilemapping:
Pretty much, it stores the tilemap as a 64x96 black and white picture. I pixel test a spot and then I pixel test the surrounding pixels. Depending on the surrounding, the tile changes. For example, pretend o is pixel off and x is pixel on. We are looking at the center:
o x o
0 x x
0 0 0
For the maze game, since the pixel above is black, I will use a tile with an opening upward and since the tile to the right is black, I use a tile that is also opening right. This way, each bit can be one of 6 tiles
It makes it verrry easy to draw tilemaps and pipes and whatnot without the user having to cycle through tiles. Also, I noticed this method on my Advanced Wars 2 game (for the GBA). You can also apply this method to do multiple types of tiles as well (like mountains and trees that vary depending on the surrounding). For that, you will need more layers.
EDIT: As a note, when the program in the screenie is in map editor mode, all it is really doing is turning a pixel on or off on the map and then checking the surrounding pixels to see what changes. The method allows for easy editing and scrolling