In optics, a "ray" is an idealization. it is perfectly thin, perfectly straight line of light.
A "beam" is a narrow cone of light. The light is confined to a small angle rather than being allowed to spread in all directions. However, it still has a little spread to it, and mathematically it is made up of an infinite number of rays.