Gut microbiota is a complex system that starts to take shape early in life. Several factors influence the rise of microbial gut colonization, such as term and mode of delivery, exposure to antibiotics, maternal diet, presence of siblings and family members, pets, genetics, local environment, and geographical location. Breastfeeding, complementary feeding, and later dietary patterns during infancy and toddlerhood are major players in the proper development of microbial communities. Nonetheless, if dysbiosis occurs, gut microbiota may remain impaired throughout life, leading to deleterious consequences, such as greater predisposition to non-communicable diseases, more susceptible immune system and altered gut–brain axis. Children with specific diseases (i.e., food allergies, inborn errors of metabolism, celiac disease) need a special formula and later a special diet, excluding certain foods or nutrients. We searched on PubMed/Medline, Scopus and Embase for relevant pediatric studies published over the last twenty years on gut microbiota dietary patterns and excluded case reports or series and letters. The aim of this review is to highlight the changes in the gut microbiota in infants and children fed with special formula or diets for therapeutic requirements and, its potential health implications, with respect to gut microbiota under standard diets.