For Boeing it is the customer code that follows. More information here:

http://en.wikipedia.org/wiki/Boeing_customer_code
For Airbus it is based on engine type. Here is a list i put together once:

Model Engine Type

A300B2-1A General Electric CF6-50A

A300B2-1C General Electric CF6-50C

A300B2-203 General Electric CF6-50C2

A300B2K-3C General Electric CF6-50CR

A300B4-103 General Electric CF6-50C2

A300B4-120 Pratt & Whitney JT9D-59A

A300B4-203 General Electric CF6-50C2

A300B4-220 Pratt & Whitney JT9D-59A

A300B4-2C General Electric CF6-50C

A300B4-601 General Electric CF6-80C2A1

A300B4-603 General Electric CF6-80C2A3

A300B4-605R General Electric CF6-80C2A5

A300B4-620 Pratt & Whitney JT9D-7R4H1

A300B4-622 Pratt & Whitney PW4158

A300B4-622R Pratt & Whitney PW4158

A300C4-605R General Electric CF6-80C2A5

A300F4-605R General Electric CF6-80C2A5 or 2A5F

A300F4-622R Pratt & Whitney PW4158

A310-203 General Electric CF6-80A3

A310-20

3C General Electric CF6-80A3

A310-204 General Electric CF6-80C2A2

A310-221 Pratt & Whitney JT9D-7R4D1

A310-222 Pratt & Whitney JT9D-7R4E1

A310-304 General Electric CF6-80C2A2

A310-308 General Electric CF6-80C2A8 or CF6-80C2A2

A310-322 Pratt & Whitney JT9D-7R4E1

A310-324 Pratt & Whitney PW4152

A310-325 Pratt & Whitney PW4156A

A318-111 CFM56-5B8/P

A318-112 CFM56-5B9/P

A318-121 PW6122A

A318-122 PW6124A

A319-111 CFM56-5B5 or 5B5/P

A319-112 CFM56-5B6 or 5B6/P or 5B6/2P

A319-113 CFM56-5A4 or 5A4/F

A319-114 CFM56-5A5 or 5A5/F

A319-115 CFM56-5B7 or 5B7/P

A319-131 IAE Model V2522-A5

A319-132 IAE Model V2524-A5

A319-133 IAE Model V2527M-A5

A320-111 CFM56-5A1 or 5A1/F

A320-211 CFM56-5A1 or 5A1/F

A320-212 CFM56-5A3

A320-214 CFM56-5B4 or 5B4/P or 5B4/2P

A320-216 CFM56-5B6

A320-231 IAE Model V2500-A1

A320-232 IAE Model V2527-A5

A320-233 IAE Model V2527E-A5

A321-111 CFM56-5B1 or 5B1/P or 5B1/2P

A321-112 CFM56-5B2 or 5B2/P

A321-131 IAE Model V2350-A5

A321-211 CFM56-5B3 or 5B3/P or 5B3/2P

A321-212 CFM56-5B1 or 5B1/P or 5B1/2P

A321-213 CFM56-5B2 or 5B2/P

A321-231 IAE Model V2533-A5

A321-232 IAE Model V2530-A5

A330-201

GE CF6-80E1A2

A330-202

GE CF6-80E1A4 / CF6-80E1A4B

A330-203

GE CF6-80E1A3

A330-221 PW4164

A330-222 PW4168

A330-223 PW4168A / PW4168A-1D / PW4168B / PW4170

A330-223F PW4170

A330-243

RR Trent 772B-60

A330-243F

RR Trent 772B-60

A330-244

RR Trent 775-60

A330-301

GE CF6-80E1A2

A330-302

GE CF6-80E1A4 / CF6-80E1A4B

A330-303

GE CF6-80E1A3

A330-321 PW4164

A330-322 PW4168

A330-323 PW4168A / PW4168A-1D / PW4168B / PW4170

A330-341

RR Trent 768-60

A330-342

RR Trent 772-60

A330-343

RR Trent 772B-60

A330-343

RR Trent 772C-60

A340-211 CFM 56-5C2

A340-212 CFM 56-5C3

A340-213 CFM 56-5C4

A340-311 CFM 56-5C2

A340-312 CFM 56-5C3

A340-313 CFM 56-5C4

A340-541

RR Trent 553-61

A340-642

RR Trent 556-61

A380-841

RR Trent 970/B

A380-842

RR Trent 972/B

A380-843F

RR Trent 977/B

A380-861

GP 7270

A380-863F

GP 7277