Logic in computer science refers to the study of principles and rules used to describe and reason about the behavior of computer systems. It involves the investigation of formal languages, mathematical models, and deduction systems to understand and analyze the properties of algorithms and programs.