HIERACHY: "Seed" is the most basic term, the other terms are characterizations of seeds. However, the use of any given term in a culinary settings may have little to do with the term's strict botanical definition. For culinary purposes there are no definite rules for which things are called nuts, pits, beans, grains, etc.
For example, the term beans used to be exclusively used for broad beans (fava beans), but today we use the term to describe plants as biologically and geographically disparate as soy, garbanzo, coffee, legumes, castor, and cocoa.
Kernel does not only refer to the center part of a nut. It is also regularly used to refer to the individual seeds of corn/maize, wheat, buckwheat, and barley.
Grains used to refer specifically to the seeds of grass food crops like wheat, barley, oats, and corn/maize. Today it is also a catch-all term which is used for similar food crops that are not grass seeds such as amaranth, millet, quinoa, rice, buckwheat, and even soy.
As a culinary term, "nut" has also undergone an expansion of meaning from, as you put it, "a fruit composed of a hard shell and a seed, which is generally edible" to include basically any relatively large, oily kernels found within a shell and used in food. In fact, the majority of the "nuts" we commonly eat are not true nuts.