A BAM file (.bam) is the binary version of a SAM file.
A SAM file (.sam) is a tab-delimited text file that contains sequence
alignment data. These formats are described on the SAM Tools web site:
http://www.htslib.org.
With 'view' option of samtools, a bam file can be translated into
viewable text .sam form.
Refer to
SAM File Format for details.