The process by which a cell becomes specialized to carry out a specific role by turning specific genes "on" and "off" and making different suites of proteins.