There are thirty nine Ab Melakhoth (primary forbidden Shabbath labors) that one is forbidden to do on Shabbath. These Melakhoth are based on the Melakhoth that were done in the Mishkan (Tabernacle). One of the Ab Melakhoth is the Melakha of Borer (separating). In the Mishkan they would dye different items with spices (Samamanim).
They would store away the plants that they used for the dyeing process, until they were needed. When they removed them from storage, pebbles and debris would gather with the Samamanim. They would remove these things from the Samamanim before starting the dye process. Therefore Borer is considered one of the AB Melakhoth (PRIMARY labors).
Since the way that Borer was done in the Mishkan included plants as well as pebbles and the like, the Melakha of Borer is not limited to things that grow from the ground. Borer includes all objects. Therefore, anytime you have a mixture of two or more types of things it is forbidden to take that which you do not want, or even that which you do want (with certain exceptions), from the mixture.
(See Ba'al HaMaor, Kaf Hahaim oth 25. And see Teshuboth Ribbi 'Aqiba Eiger 20)
melacha, melakha, Shabbos, Shabbat, Shabbath, borer, separating, halacha