CB31 1 3720
The CB31 stamped frame would appear to have been used for both the B31 (350cc) or B33 (500cc) swinging arm models so it's probable that it started out as a B33, the B31 and B33 models being very similar apart from the capacity difference.
If the single '1' digit is part of the actual number (13720) then that could date the frame to 1955?
However if the single digit is not part of the number I don't know the reason for it and the number 3720 would place it as 1954.
BB31 3877
The engine would most likely have originally been from a 1953 B31 (350cc) model, although the number only identifies the crankcase so (as you have said) it could have been modified with Gold Star parts and may now be 500cc?
BSA number info:
http://www.bsaoc.demon.co.uk/1951-60.htmlAn example of a 1958 model B31 in the pictures section:
http://www.vintagebike.co.uk/Bike%20Directories/BSA%20Bikes/pages/BSA%20B31%201958.htmYou may be able to find out more information from the BSA Owners Club?:http://www.bsaoc.demon.co.uk/