I don't know how worms did their terrain generation but there are many ways to generate terrain.
Midpoint works by taking a straight line, and pulling the center up or or down a random height. Then split the line into 2 and pull the centers up or down a smaller random number. Then split the line into 4, 8, etc etc.
Perlin Noise is a bit tricky to explain, but in essence makes black and white clouds which you can use as a height map. However recommend reading it, it serves well in all things procedural.
Faulting is similar to midpoint, you pick a random point on your terrain, raise one side, lower the other side, keep doing this until happy :)
I think L-Systems would be the best for this, abit trick again to explain but I'll give it a shot. L-Systems work with Strings and Rules. So if 'A' represented a flat line. I could have a rule that said make every 'A' 'AABB', so our string becomes 'AABB', then the next rule might be make every 'AB' 'BCB' in which case our string would become 'ABCBA'. Each letter would represent something in you landscape, which would generate the overall picture. (Bad explanation sorry.)