Often when we read about global access modifiers we come across that it "should be used for any method that needs to be referenced outside of the application". Now I understand that in case of managed package or APIs we do require it. But what I wanted to understand is, is the term 'application' in the quoted text above mean the SF application we are working on like Sales or any custom SF app? Does that mean if I were to make my code visible to the some custom SF app (lets say, ABC) & currently the class I'm working on is part of Sales app, would I require global keyword?
If yes, then how does SF understands that a particular class is part of which app? I don't think there is any metadata to store such info, right?