There are two parts to that, visual and collisions.
For the visual you can either pre-draw the terrain or use the paster object to draw a bunch of quads to distort an image. Here's an example that distorts a image, so maybe it could be useful. The math may not be useful in your case but the gist of it is just have a bunch of quads next to each other with the corners moved to distort things. If you've done uv texturing in 3d software, the idea can be used here and the more quads you use the smoother it will be.
The collision portion is the next problem. Here's one that takes a vector image export and creates a bunch of lines to use as the terrain. Another option is to use the points of the quads from the visual portion and use them instead to place the collision lines.
On a side note the ground tile can be added by using a blend mode.
Here's a more specific example:
https://www.dropbox.com/s/mzfhqnp4u4isy ... .capx?dl=1
It creates the hills using sprites used as lines. I wasn't super creative so I made the shape of the hills the combination of two sine waves. Look at the set y action in event 2.
It also fills in the area below those sprites so it's a filled area. The tiled background is then pasted with the source in blend to texture that area.
The final step is to loop over the line sprites again draw a textured quad on the surface for each one.
It works, and shows a simple case, but it would need more work to do scrolling and such.