How to factory reset CyanogenMod?
You can go to the ClockWorkMod Recovery by pressing VolumeUp+Power+home button (For devices that have physical home buttons. Yours does!) In that you have the option to do factory reset/wipe data. Also don;t forget to wipe dalvik cache. That way your phone will reset to CyanogenMod factory default. However if you want to restore to Samsung Factory default you have to download the original firmware and flash it using Odin or any other software. Detailed guides can be found online