Magmatic differentiation is a process that occurs when magma cools and changes composition as it forms different types of rocks. In a magma chamber, when molten rock (magma) starts to cool, the minerals that form first are usually ones that crystallize at higher temperatures. As these minerals crystallize, they take certain elements out of the magma, changing what the remaining liquid looks like.
For example, if the first crystals to form are rich in iron and magnesium, the leftover magma will have less of these elements and will become richer in silica. This can lead to the formation of magmas with different compositions, such as basalt (rich in iron and magnesium) and rhyolite (rich in silica). So, as the magma cools, it can create various types of magmas depending on which minerals form and how they change the composition of the remaining liquid.