MBTiles is a specification for storing arbitrary tiled map data in SQLite databases for immediate usage and for efficient transfer. MBTiles files, known as tilesets, must implement the specification below to ensure compatibility with devices.
I think I used TileStache in the day to generate our custom tiles? But I don't remember exactly.
There are currently lots of implementations of generators and servers.
see also PMTiles