Structure is one of the most important qualities of a soil, and is perhaps the crucial difference between soil and "dirt". The tiniest soil particles attach themselves to each other, and those clumps cling to each other, on up through a size hierarchy of soil aggregates. The aggregates define pore space that is vital for movement of water, air, soil animals, and for the growth of roots.
Soil aggregates are held together by different forces at different size scales. In the smallest sizes ionic forces dominate, then bacterial polysaccharides take over in somewhat larger aggregates. In the size range that is readily visible in soil, mycorrhizal fungi play the central role. They produce a glycoprotein called "glomalin", named after the group of fungi that form endomycorrhizae. You can find a great deal of information on the internet by performing a search for the word "glomalin".