For searching, the value of the variable case-fold-search determines whether they are case sensitive:
(setq case-fold-search nil) ; make searches case sensitive (setq case-fold-search t) ; make searches case insensitive
Similarly, for replacing the variable case-replace determines whether replacements preserve case.
To change the case sensitivity just for one major mode, use the major mode's hook. For example:
(setq XXX-mode-hook (function (lambda () (setq case-fold-search nil))))