I am using moodle 2.8.1
My query is regarding Moodle registration form:
I want to add a confirm password field which would be required same as Email(again) field
We made a small open source module covering this use case.
It adds the field on the fly in the registration form, along with the necessary validation, using addRule and the compare rule.
If you want to add fields to the registration form, you can do it using user profile fields in Site administration > Users > Accounts > User profile fields.
You have to set 'Display on signup page', which will show the field in the signup form, and 'Who is this field visible to' .
If you need more details refer: http://docs.moodle.org/26/en/User_profile_fields
Hope this helps.