Soft robotic grippers are widely used in different industrial applications since they show great advantages in the adaptable grasping of objects with irregular shapes. However, as many soft grippers have a monolithic structure and gain their motion from the elastic deformation, it is difficult to use the conventional rigid-body mechanism theory to synthesize the shape of the soft grippers. To cope with this problem, the topology optimization is frequently employed as synthesis method since it can achieve automatic design of continuum-structure mechanisms. In this paper, we propose a novel 3D topology optimization framework in MATLAB to achieve automatic design of soft robotic grippers. Two design examples are also presented to illustrate the automatic synthesis process. Experimental tests have shown that the 3D topology optimized grippers in the example can successfully grasp objects with different shapes. In future work, the proposed framework can be further developed to synthesize soft robotic grippers with different actuation mechanisms and task-specific grasping behaviors.