for .htpasswd file syntax is easy :
each line is composed by two parts - user name and user password encrypted - with a : between them.
password could be encrypted by crypt() php function :
$enc_pass = crypt($pass_to_crypt);
which crypt the password in unix standard (DES if i can remeber). so a line should look like this:
admin:AFIBAIBSICN
jope:YCVY6VU8bfu
etc.
in your file