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.
Another note is that the "Paste into Canvas" uses that objects X and Y values, so you need to have an instance of the object where you want it to be pasted. A good idea, if you're using a mask with say a bullet, is to add the mask object to the bullet objects container, and add an event to place the mask object at the bullets position. Alternatively, use "On Bullet overlaps Canvas" -> "Bullet: Create Object 'Hole' at Image point 0" or wherever to erase it.