I’m not talking about organic vs GMO or anything like that here (that’s another topic altogether). In this context, “quality” comes down to simplifying the process of getting the food from its source to your stomach. Avoiding highly processed foods with lots of additives like preservatives, artificial sweeteners, partially hydrogenated fats (trans fats), etc can be very positive for your gut health overall. Sometimes it is one or multiple of these things that can give people digestive issues, or at least irritate existing ones.
I list artificial sweeteners here not because of a concern for impact on insulin (as existing evidence doesn’t support that very well), but because they can feed certain gut bacteria and increase their growth which may not be a good thing in all cases. If there is already an imbalance in gut flora, artificial sweeteners can sometimes make it worse.
Choose single ingredient foods for the most part and sticking with getting fresh whenever possible can be a good start to troubleshooting and working on improving gut health.