The example shows it as it is.
Create a Canvas with your terrain. Create a separate Sprite (for example, in worms, a bazooka hole) which will be erased from the canvas.
Use 'Paste into canvas' with this sprite, then Update collision mask. A hole will be made in the terrain and can be collided with/into.