Compartmentalization can refer to two different things; compartmentalization and "doublethink".
The term "compartmentalization" refers to the practice of behaving a certain way under certain circumstances and behaving the exact opposite at all other times. An example would be a geologist who studies the age of the earth. When he's at his job he believes that the earth is 4.55 billion years old in order for the evidence he finds to make sense. However, when he goes to church he might temporarily reject his beliefs and believe that the earth is 6,000 years old instead while he's at worship. After church is over, though, he returns to his job and his belief a 4.55 billion year old earth returns as well. Obviously one can't believe in both an old and a young earth simultaneously, but the geologist does because the two aspects of his life require the difference in beliefs.
"Doublethink" is the practice of believing one thing in certain situations and believing the exact opposite at all other times. The person essentually holds to contradictary beliefs at the same time without recognizing the contradtion. The term originates from George Orwell's novel 1984 in which he defined it as "...the power of holding two contradictory beliefs in one's mind simultaneously, and accepting both of them."
For example, the Creationist speaker Kent Hovind often states that the geological column is simply the result of the Noachian Flood yet he is also known for his belief that the geological column is fiction created by scientists which doesn't really exist in real life. One can easily see the contradiction; either the geological column exists or it doesn't. A clearer example is his common statement that no scientist dares to speak out against evolutionary "dogma" yet he also provides quotes of scientists admitting that evolution is wrong.