The medical specialty that is concerned with the rectum and anus is proctology.