This book presents a systematic treatment of Gröbner bases in several contexts. The book builds up to the theory of Gröbner bases for operads due to the second author and Khoroshkin as well as various applications of the corresponding diamond lemmas in algebra. Throughout the book, both the mathematical theory and computational methods ar