The role of the gut microbiota in understanding the onset and development of obesity is gaining importance. Dietary strategies are the main tool employed to counteract obesity, and nowadays they are focused on a wide range of different aspects of diet and not only on calorie restriction. Additionally, diet is known to be a major factor influencing modification of the gut microbiota. Therefore the influence of both macronutrient and micronutrient content of any dietary strategy to treat obesity on gut bacterial composition should now be taken into consideration, in addition to energy restriction. This review aims to collect the available data regarding the influence of different dietary components on gut microbiota in relation to obesity and inflammatory states in humans. Although more work is needed, specific dietary factors (carbohydrate, protein and Mediterranean foods) have been shown to have an influence on the gut microbiome composition, meaning that there is an opportunity to prevent and treat obesity based on microbiota outcomes.