How is it possible for rocks to be trapped within another type of rock? More specifically, I would like to know how the rocks in these pictures have formed:



If this is because magma has melted and trapped the other rocks inside, do they have a different melting point then?
Images are from St. Blaize Trail in Mossel Bay, South Africa
There are three major types of geological formations that contain or are composed of various rocks:

breccia
conglomerate
xenoliths

Breccia
The word breccia comes from the Italian word for rubble. There are various forms of breccia:

sedimentary
tectonic
igneous
impact
hydrothermal

The clast (rock fragments) within breccia are angular in shape and generally randomly orientated, a opposed to a conglomerate which is composed of rounded fragments.
Sedimentary beccia generally formed in ancient stream beds. Igneous breccia forms as a result of rocks being torn away during volcanic eruptions. Impact beccia results from the impact of meteorites. Hydrothermal breccia results from fissure opening up due to seismic or volcanic activity &amp; hydrothermal fluids (hot water) entering the fissure causing the sides of the fissure to collapse inwards.
Conglomerate
Conglomerates contain rounded rocks bound within a sedimentary unit. They form either within ancient stream systems or in marine environments. They can also form as a result of glacial activity.
Xenolith
Xenoliths are fragments of rock contained with igneous rocks. Their spacing with the host rock is much greater than that of beccia or conglomerate - they are more isolated. They generally result from volcanic eruptions.