Any file is made up of a sequence of bytes. Each byte is a sequence of 8 bits. Each bit is either 1 or 0. Therefore, each byte can have a value between 0 and 255. Using
ASCII encoding, each byte value represents a particular character, such as 'A', 'B', 't', '#', etc. In the entire range of 256 ASCII characters, only a subset are considered to be "printable". If there is a file made up of only those printable characters, that file is considered to be "text". If there is a single character outside of the "printable" range, the file is considered to be binary.
A "text" file is sometimes treated specially and can have its line ending character \n, \r, or both, changed or switched around depending on the operating system. It is a long story.
A hex editor will display all of the printable characters in a file and represent the non-printable characters with just a '.' or space. It will also display the hexadecimal value of each character, printable and non-printable. It may also be able to group bytes together and extract some higher-level meaning out of them.