It is an interesting characteristic of pretty much anything that if you increase its strength, you increase its brittleness as well. Therefore, while 8grade fasteners are significantly stronger than 5grade in both tensile and shear strength, the 5grade will have a higher tolerance for "plastic" deformation (stretch and suchlike) than 8grade of equal size.
What to use where? Depends on application. I'd probably use something like brass for anything exposed to the elements that does not require significant tensile or shear strength (non-structural panel work, simple retention undercar, &c) vice alloy steel or CRES simply because I'd be more interested in corrosion resistance than in brute strength. As a result, I use a LOT of brass! (No, I've not had a fastener failure as a result.)
If I'm worried about fastener strength in a tensile plane (along then length,) fastener design becomes just as important as material. Without wandering into exotic profiles, some of the strongest fastener shapes you can get for machine screws are the socket head screws in Torx or hex socket. By lessening the relative size difference between the head and the shank of the fastener, stress risers are reduced and overall strength is increased as a result. A socket head will have greater tensile strength than a hex head fastener in the same nominal size and material. This has to do with the flow of "stress lines" through the fastener body. Note that tensile strength is measured in ksi (thousand psi,) so increasing the nominal diameter will also increase available tensile strength. However, this does not necessarily make up for shonky design or bad fastener choices.
If I am looking for shear strength, I will go for a larger nominal diameter to offer more area to the stress plane. Why? More material can equal more strength.
Note that ANSI grade levels trypically are only applied to carbon alloy steel - CRES alloys and nonferrous alloys answer to their own specifications. Getting you hands on a recent copy of Machinery's Handbook is always a good thing - but another excellent book on the subject is "Nuts, Bolts, and Plumbing" (or something similar!) by Carroll Smith - and I usually spot it at Barnes & Noble in the "transportation" section for a tad less than $20. It's written in layman's terms and well-presented by an individual with a great deal of experience and a pleasing dry wit - much easier to read than MH!
5-90