After birth, development of a normal microbial community occurs gradually, and is affected by factors such as the composition of the maternal gut microbiota, the environment, and the host genome. Diet also has a direct influence, both on composition and activity of this community. This influence begins with the milk, when specific components exert their growth-promoting effect on a beneficial microbiota, thereby suppressing potential pathogens. For example, breast-fed infants compared with formula-fed babies usually have a microbial community dominated by bifidobacteria. When solid food is introduced (weaning), dramatic changes in microbial composition occur, so pathogens can gain access to the disturbed gastrointestinal (GI) ecosystem. However, use of specific dietary components can alter the composition and activity of the microbiota positively. Of all dietary components, fermentable carbohydrates seem to be most promising in terms of promoting proliferation of beneficial bacterial species. Carbohydrate fermentation results in the production of SCFA which are known for their trophic and health-promoting effects. Fermentation of proteins, on the other hand, is often associated with growth of potential pathogens, and results in production of detrimental substances including NH3 and amines. In terms of the GI microbiota, lipids are often associated with the antimicrobial activity of medium-chain fatty acids and their derivatives. The present review aims to provide deeper insights into the composition and development of the neonatal GI microbiota, how this microbiota can be influenced by certain dietary components, and how this might ultimately lead to improvements in host health.