This action is useful when you have to make customized changes on a default RPM package(compiling parameters, file paths, release version, etc). To do that, first Install the source RPM of the package you want to generate, this usually has the suffix "src.rpm".
After installing it, you can make changes on the .spec file and start building the RPM package, note that any changes/errors on the .spec file will reflect on the entire build process, so pay attention to multiple "%define" entries, even with the "#" comment prefix it becomes valid inside the code. The .spec file is usually located on /usr/src/redhat/SPECS directory.
To starting the build process execute the following command:
rpmbuild -ba path/to/package.spec
The above command will generate RPM package(s) on directory /usr/src/redhat/RPMS/arch, where "arch" depends on your system and build process configuration. If all goes ok you can install the generated package(s) with no problems.
NOTE: We don't encourage you to do this task as root user, to learn how to make you own rpmbuild environment, see Thomas's Tutorial: How to create a rpmbuild directory.